import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.stream.Stream;

public class RemoveNumber {

  public static void main(String[] args) {
    Arrays.stream(args)
        .forEach(
            fileName -> {
              Path filePath = Paths.get(fileName);
              try (FileOutputStream os = new FileOutputStream(fileName + ".bak", true);
                  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os))) {
                Stream<String> lines = Files.lines(filePath);
                lines.forEach(
                    e -> {
                      char[] chars = e.toCharArray();
                      int index = 0;
                      // 全数字
                      boolean isAllDigit = true;
                      for (int i = 0; i < chars.length; i++) {
                        if (!Character.isDigit(chars[i])) {
                          index = i;
                          isAllDigit = false;
                          break;
                        }
                      }
                      if (isAllDigit) {
                        index = chars.length;
                      }
                      String newLine = new String(Arrays.copyOfRange(chars, index, chars.length));
                      try {
                        writer.write(newLine);
                        writer.newLine();
                      } catch (IOException ex) {
                        ex.printStackTrace();
                      }
                    });
              } catch (IOException e) {
                e.printStackTrace();
              }
            });
  }
}